using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SPCAMLEditor
{
    public partial class ConfigDialog : Form
    {
        public ConfigDialog()
        {
            InitializeComponent();

            this.FormBorderStyle = FormBorderStyle.FixedSingle;
        }

        private void okBtn_Click(object sender, EventArgs e)
        {
            Config cfg = Config.LoadConfig();

            cfg.AutoSaveViewSchema = this.autoSaveViewCheckbox.Checked;
            cfg.AutoSaveFieldSchema = this.autoSaveFieldCheckbox.Checked;

            cfg.Save();

            this.DialogResult = DialogResult.OK;
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void ConfigDialog_Load(object sender, EventArgs e)
        {
            Config cfg = Config.LoadConfig();

            this.autoSaveViewCheckbox.Checked = cfg.AutoSaveViewSchema;
            this.autoSaveFieldCheckbox.Checked = cfg.AutoSaveFieldSchema;
        }
    }
}